package com.aspose.cells;

import java.util.ArrayList;
import java.util.List;

final class zbvw {
   static ArrayList a(zn var0, zbcq var1, com.aspose.cells.b.a.b.zp var2, float var3, double var4, int var6) {
      zig var7 = var1.v();
      int var8 = var1.ag();
      zbp var9;
      zbp var10;
      if (var8 == 1) {
         var10 = var7.e();
         var9 = var7.G();
      } else {
         var10 = var7.g();
         var9 = var7.I();
      }

      double var11 = var9.n() ? var9.g(var9.D()) : var9.D();
      double var13 = var9.n() ? var9.g(var9.z()) : var9.z();
      var4 = var9.n() ? var9.g(var4) : var4;
      double var15 = var10.n() ? var10.g(var10.D()) : var10.D();
      double var17 = var10.n() ? var10.g(var10.z()) : var10.z();
      boolean var19 = var1.M();
      zalw var20 = var1.P();
      zalw var21 = var1.Q();
      zix var22 = var1.T();
      zix var23 = var1.U();
      ArrayList var24 = new ArrayList();
      double var25 = var17 - var15;
      int var27 = var6;
      if (var10.p && !var10.q) {
         var27 = (int)var10.z();
         if (var10.f()) {
            var25 = var17 - var15 + 1.0D;
         }

         if (var10.u && !var10.f()) {
            var25 += 0.5D;
         }
      }

      double var28 = (double)var2.e() / var25;
      ArrayList var30 = new ArrayList();
      ArrayList var31 = new ArrayList();
      zjg var32 = var1.E();

      for(int var33 = 0; var33 < var27; ++var33) {
         zje var34 = var32.b(var33);
         if (var34 != null && !var34.a() && !var34.b()) {
            double var35 = (double)((float)var28) * (var34.q() - var15);
            if (var10.f()) {
               var35 += (double)((float)var28 / 2.0F);
            }

            if (var10.p()) {
               var35 = (double)(var2.c() + var2.e()) - var35;
            } else {
               var35 += (double)var2.c();
            }

            double var37 = (double)var3;
            double var39 = var34.v();
            double var41 = (var39 - var4) / (var13 - var11) * (double)var2.f();
            zsq var43 = var1.y();
            com.aspose.cells.b.a.b.zo var44 = new com.aspose.cells.b.a.b.zo((float)var35, var3);
            double var45 = 0.0D;
            double var47 = 0.0D;
            float var49 = 0.0F;
            float var50 = 0.0F;
            if (var43 != null) {
               switch(var43.g()) {
               case 0:
                  double var51 = var43.e().size() > var33 ? var43.a(var43.e().get(var33)) : 0.0D;
                  var45 = var51;
                  var51 = var43.f().size() > var33 ? var43.a(var43.f().get(var33)) : 0.0D;
                  var47 = var51;
                  break;
               case 1:
                  var45 = var43.c();
                  var47 = var45;
                  break;
               case 2:
                  var45 = var43.c() * var34.q() / 100.0D;
                  var47 = -var45;
               }

               var49 = (float)(var45 / (var17 - var15) * (double)var2.e());
               var50 = (float)(var47 / (var17 - var15) * (double)var2.e());
               if (!var9.p()) {
                  var44.b(var44.e() - (float)var41);
               } else {
                  var44.b(var44.e() + (float)var41);
               }
            }

            var43.a(var44, var49, var50);
            zsq var59 = var1.x();
            var45 = 0.0D;
            var47 = 0.0D;
            var49 = 0.0F;
            var50 = 0.0F;
            if (var59 != null) {
               switch(var59.g()) {
               case 0:
                  double var52 = var59.e().size() > var33 ? var59.a(var59.e().get(var33)) : 0.0D;
                  var45 = var52;
                  var52 = var59.f().size() > var33 ? var59.a(var59.f().get(var33)) : 0.0D;
                  var47 = var52;
                  break;
               case 1:
                  var45 = var59.c();
                  var47 = var45;
                  break;
               case 2:
                  var45 = var59.c() * var34.v() / 100.0D;
                  var47 = -var45;
               }

               var49 = (float)var45 / (float)(var13 - var11) * (float)var2.f();
               var50 = (float)var47 / (float)(var13 - var11) * (float)var2.f();
            }

            var59.a(var44, var49, var50);
            if (!var9.p()) {
               var37 -= var41;
            } else {
               var37 += var41;
            }

            com.aspose.cells.b.a.b.zo var60 = new com.aspose.cells.b.a.b.zo((float)var35, (float)var37);
            com.aspose.cells.b.a.a.ze.a(var31, (Object)var60);
            zpu var53 = var34.o();
            int var54 = var10.n() ? zbuk.g((Double)var34.s()) : 0;
            int var55 = var9.n() ? zbuk.g((Double)var34.x()) : 0;
            boolean var56 = true;
            boolean var57 = true;
            if (var10.p) {
               if (var10.n() && zbuk.a(var10.h(var34.q()), var54) <= zbuk.a(var10.h(var17 + 0.5D), var54) && zbuk.a(var10.h(var34.q()), var54) >= zbuk.a(var10.h(var15 - 0.5D), var54) || !var10.n() && var34.q() <= var17 + 0.5D && var34.q() >= var15 - 0.5D) {
                  var56 = false;
               }
            } else if (var10.n() && zbuk.a(var10.h(var34.q()), var54) <= zbuk.a(var10.h(var17), var54) && zbuk.a(var10.h(var34.q()), var54) >= zbuk.a(var10.h(var15), var54) || !var10.n() && var34.q() <= var17 && var34.q() >= var15) {
               var56 = false;
            }

            if (var9.n() && zbuk.a(var9.h(var34.v()), var55) <= zbuk.a(var9.h(var13), var55) && zbuk.a(var9.h(var34.v()), var55) >= zbuk.a(var9.h(var11), var55) || !var9.n() && var34.v() <= var13 && var34.v() >= var11) {
               var57 = false;
            }

            if (var53.t() && !var56 && !var57) {
               Object[] var58 = new Object[]{var1.aj(), var33, var60, var10};
               com.aspose.cells.b.a.a.ze.a(var24, (Object)var58);
            }
         } else {
            com.aspose.cells.b.a.a.ze.a(var31, (Object)null);
         }
      }

      if (var31.size() > 1) {
         zkr.a(var0, var1, var31, var2);
      }

      a(var0, var1, var31, var2);
      com.aspose.cells.b.a.a.ze.a(var30, (Object)var31);
      return var24;
   }

   static void a(zn var0, zbcq var1, List var2, com.aspose.cells.b.a.b.zp var3) {
      var3 = new com.aspose.cells.b.a.b.zp(var3.c(), var3.d(), var3.e(), var3.f());
      var3.a(1, 1);

      for(int var4 = 0; var4 < var2.size(); ++var4) {
         Object var5 = var2.get(var4);
         if (var5 != null) {
            zje var6 = var1.E().b(var4);
            if (var6 == null || !var6.d() && !var6.e() && !var6.c()) {
               com.aspose.cells.b.a.b.zo var7 = (com.aspose.cells.b.a.b.zo)var5;
               if (var7.d() >= (float)var3.c() && var7.e() >= (float)var3.d() && var7.d() <= (float)var3.i() && var7.e() <= (float)var3.j() && var6.m().g()) {
                  var6.m().a(var7.d(), var7.e());
               }
            }
         }
      }

   }
}
